class VillesController < ApplicationController
  # GET /villes
  # GET /villes.xml
  def index
    @villes = Villes.find(:all)

    respond_to do |format|
      format.html # index.rhtml
      format.xml  { render :xml => @villes.to_xml }
    end
  end

  # GET /villes/1
  # GET /villes/1.xml
  def show
    @villes = Villes.find(params[:id])

    respond_to do |format|
      format.html # show.rhtml
      format.xml  { render :xml => @villes.to_xml }
    end
  end

  # GET /villes/new
  def new
    @villes = Villes.new
  end

  # GET /villes/1;edit
  def edit
    @villes = Villes.find(params[:id])
  end

  # POST /villes
  # POST /villes.xml
  def create
    @villes = Villes.new(params[:villes])

    respond_to do |format|
      if @villes.save
        flash[:notice] = 'Villes was successfully created.'
        format.html { redirect_to ville_url(@villes) }
        format.xml  { head :created, :location => ville_url(@villes) }
      else
        format.html { render :action => "new" }
        format.xml  { render :xml => @villes.errors.to_xml }
      end
    end
  end

  # PUT /villes/1
  # PUT /villes/1.xml
  def update
    @villes = Villes.find(params[:id])

    respond_to do |format|
      if @villes.update_attributes(params[:villes])
        flash[:notice] = 'Villes was successfully updated.'
        format.html { redirect_to villes_url(@villes) }
        format.xml  { head :ok }
      else
        format.html { render :action => "edit" }
        format.xml  { render :xml => @villes.errors.to_xml }
      end
    end
  end

  # DELETE /villes/1
  # DELETE /villes/1.xml
  def destroy
    @villes = Villes.find(params[:id])
    @villes.destroy

    respond_to do |format|
      format.html { redirect_to villes_url }
      format.xml  { head :ok }
    end
  end
end
